package eerbaar.v2.graphics;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;

public class Text {

    public static final String FONT_X = "14px Courier New";
    public static final int HEIGHT = 18;
    public static final Font FONT = new Font(FONT_X, Font.PLAIN, 12);

    private static int calcWidgth(Graphics graphics, String text) {
        int length = graphics.getFontMetrics().stringWidth(text);
        return length;
    }

    private final String text;

    public Text(String text) {
        this.text = text;
    }

    public Dimension getDimension(Graphics graphics) {
        return new Dimension(calcWidgth(graphics, this.text), HEIGHT);
    }

    public String getText() {
        return this.text;
    }

}
